<template>
  <div>
    <span>{{search}}跟进记录</span>
    <div v-for="item in trackList">
      <el-row>
        <el-col :span="8"><span>下次跟进时间</span></el-col>
        <el-col :span="16"><span>{{item.nextTime}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8"><span>操作时间</span></el-col>
        <el-col :span="16"><span>{{item.operTime}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8"><span>沟通内容</span></el-col>
        <el-col :span="16"><span>{{item.record}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8"><span>操作人</span></el-col>
        <el-col :span="16"><span>{{item.createBy}}</span></el-col>
      </el-row>
      <hr>
    </div>
  </div>
</template>

<script>
import { listTrackLog } from "@/api/crm/trackLog";

export default {
  name: "track-list",
  props:{
    search:{
      type: String,
      default: '商机'
    },
    id:{
      type:[Number,String],
      default: 0
    }
  },
  data(){
    return{
      trackList: [],
    }
  },
  created() {
    this.getList();
  },
  methods: {
    getList(){
      // list({title: '线索跟踪记录'}).then(res =>{
      //     this.dataList = this.parseData(res.rows)
      // })
      listTrackLog({id: this.id,table: this.search}).then(resp =>{
        this.trackList = resp.rows
      })
    },
    parseData(result){
      let list = [];
      if (result && result.length > 0){
         for (let item of result){
           let operParam = JSON.parse(item.operParam)
           if (operParam.id == this.id){
             item.operParam = operParam
             list.push(item)
           }
         }
      }
      return list;
    }
  }
}
</script>

<style scoped>

</style>
